use crate::config;
use crate::config::{BIN_FULL, SMALL_WSIZE_MAX};
use crate::page::Page;

pub struct Heap {
    // TODO: thread_delayed_free
    /// Thread this heap belongs to.
    thread_id: usize,
    /// Pages pointers array.
    /// For small objects under 1Kb, an entry of this array points to the first available page in that size class.
    /// TODO: raw ptr
    pages_direct: [*mut Page; SMALL_WSIZE_MAX + 1],
    /// Queue of pages for each size class (or "bin").
    pages: [PagesOfBlockSize; BIN_FULL + 1],
}

/// Pages of a certain block size are held in a queue.
/// TODO: raw ptr
struct PagesOfBlockSize {
    first: *mut Page,
    last: *mut Page,
    block_size: usize,
}
